package com.hursing.tractor.view;

import android.graphics.Rect;

import com.hursing.tractor.baseview.UIView;

public final class UISingleButtonPanelView extends UIView {
	
	@Override
	public UIView layout(int w, int h) {
		final int top = (int) (h * 0.54);
		final int bottom = (int) (h * 0.63);
		int minLeft = w;
		int maxRight = 0;
		
		sViews[VIEW_START_BUTTON].frame(new Rect(0, top, 0, bottom));
		int width = sViews[VIEW_START_BUTTON].measureWidth();
		int left = (w - width) / 2;
		sViews[VIEW_START_BUTTON].frame().left = left;
		sViews[VIEW_START_BUTTON].frame().right = left + width;
		minLeft = Math.min(minLeft, sViews[VIEW_START_BUTTON].frame().left);
		maxRight = Math.max(maxRight, sViews[VIEW_START_BUTTON].frame().right);
		
		sViews[VIEW_BURY_BUTTON].frame(new Rect(0, top, 0, bottom));
		width = sViews[VIEW_BURY_BUTTON].measureWidth();
		left = (w - width) / 2;
		sViews[VIEW_BURY_BUTTON].frame().left = left;
		sViews[VIEW_BURY_BUTTON].frame().right = left + width;
		minLeft = Math.min(minLeft, sViews[VIEW_BURY_BUTTON].frame().left);
		maxRight = Math.max(maxRight, sViews[VIEW_BURY_BUTTON].frame().right);
		
		mFrame = new Rect(minLeft, top, maxRight, bottom);
		return this;
	}
}
